package day02;

public class DataTypeCastDemo {
    public static void main(String[] args) {
        //类型转换的两种方式:
        /*
        int a = 6;
        double b = 2.654;
        long c = 1132546534679L;
        int d = (int)c;
        System.out.println(d);
        double e = 5;
        System.out.println(e);
        double f = 65.8165456;
        int g = (int)f;
        System.out.println(g);
        char h = (char) g;
        System.out.println(h);
        int i = h;
        System.out.println(i);
         */

        //类型转换的两点规则:
        byte aa = 5;
        byte bb = 8;
        byte cc = (byte)(aa + bb);
        System.out.println(cc);

        System.out.println(2+2);//4
        System.out.println(2+'a');//2+97=99
        System.out.println('a'+'0'+'A');//97+48+65=210
        System.out.println('a');//a

        short dd = 87;
        short ee = 99;
        short ff = (short)(dd + ee);
        System.out.println(ff);

        dd =(short) (dd+ee);
        System.out.println(dd);//186
        dd += ee;
        System.out.println(dd);//285











    }
}
